package com.siwei.mes.service.erp.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.siwei.mes.common.query.PageQuery;
import com.siwei.mes.entity.erp.Customer;
import com.siwei.mes.mapper.erp.CustomerMapper;
import com.siwei.mes.service.erp.CustomerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Customer)表服务实现类
 *
 * @author linzi
 * @since 2024-08-14 22:17:51
 */
@Service
public class CustomerServiceImpl implements CustomerService {
    @Resource
    private CustomerMapper customerMapper;

    @Override
    public PageInfo<Customer> getPage(PageQuery<Customer, Customer> query) {
        Customer searchParam = query.getParams();
        return PageHelper.startPage(query.getPageNum(), query.getPageSize())
                .doSelectPageInfo(() -> customerMapper.getList(searchParam));
    }

    @Override
    public Customer loadByCusID(Integer cusId) {
        return customerMapper.loadByCusID(cusId);
    }

    @Override
    public List<Customer> getAll(Customer entity) {
        return customerMapper.getList(entity);
    }
}
